package com.c201801020208.ybl.User.Activity;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.c201801020208.ybl.R;
import com.c201801020208.ybl.Tables.UserInfo;
import com.c201801020208.ybl.model.impl.ChatActivity;
import com.tencent.imsdk.v2.V2TIMConversation;
import com.tencent.qcloud.tim.uikit.modules.chat.base.ChatInfo;

public class jianliActivity extends AppCompatActivity {
    TextView school;
    TextView projectexperience;
    TextView salary;
    TextView username;
    TextView address;
    TextView age;
    TextView wantedjob;
    TextView sex;
    TextView workexperience;
    TextView discribe;
    TextView major;
    ImageView imageView;
    Button imageView2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_jianli);

        UserInfo userInfo = (UserInfo) getIntent().getSerializableExtra("userInfo");
        school = findViewById(R.id.textView22);
        projectexperience = findViewById(R.id.textView30);
        salary = findViewById(R.id.textView26);
        username = findViewById(R.id.textView21);
        address = findViewById(R.id.textView18);
        age = findViewById(R.id.textView47);
        wantedjob = findViewById(R.id.textView25);
        sex = findViewById(R.id.textView46);
        workexperience = findViewById(R.id.textView24);
        discribe = findViewById(R.id.textView45);
        major = findViewById(R.id.textView19);

        imageView = findViewById(R.id.imageView3);
        imageView2 = findViewById(R.id.imageView6);


        address.setText(userInfo.getAddress());
        school.setText(userInfo.getSchool());
        wantedjob.setText(userInfo.getWantedjob());
        age.setText(userInfo.getAge());
        workexperience.setText(userInfo.getWorkexperience());
        discribe.setText(userInfo.getDescribe());
        salary.setText(userInfo.getSalary());
        sex.setText(userInfo.getSex());
        projectexperience.setText(userInfo.getProjectexperience());
        username.setText(userInfo.getUsername());
        major.setText(userInfo.getMajor());

        //退出
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        //跳转至聊天页面
        imageView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ChatInfo chatInfo = new ChatInfo();
                chatInfo.setType(V2TIMConversation.V2TIM_C2C);
                chatInfo.setId(username.getText().toString());
                chatInfo.setChatName(username.getText().toString());
                Intent intent = new Intent(jianliActivity.this, ChatActivity.class);
                intent.putExtra("CHAT_INFO", chatInfo);
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
            }
        });
    }
}
